package servicetest;

import com.xugou.dao.OrderDao;
import com.xugou.dao.UserDao;
import com.xugou.pojo.Dept;
import com.xugou.pojo.Order;
import com.xugou.pojo.User;
import com.xugou.service.Impl.DeptServiceImpl;
import com.xugou.service.Impl.OrderServiceImpl;
import com.xugou.service.Impl.UserServiceImpl;
import com.xugou.service.OrderService;
import com.xugou.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * @author xugou
 * @date 2022/5/7  23:02
 */
public class OrderTest000 {

    @Test
    public void testOrderService() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userService = context.getBean("userServiceImpl", UserServiceImpl.class);
        List<User> userList = userService.getUserList();
        for (User user : userList) {
            System.out.println(user);
        }
    }

    @Test
    public void testDeptService() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        DeptServiceImpl dpetServiceImpl = context.getBean("deptServiceImpl", DeptServiceImpl.class);
        List<Dept> allDeptEmpList = dpetServiceImpl.getAllDeptEmpList();
        for (Dept dept : allDeptEmpList) {
            System.out.println(dept);
        }

    }

    @Test
    public void delOrdersService() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        OrderServiceImpl orderService = context.getBean("orderServiceImpl", OrderServiceImpl.class);
        boolean deleteOrder = orderService.isDeleteOrder(2);
        System.out.println(deleteOrder);
    }

}
